|
![](/i/fill.gif) |
"Christoph Hormann" <chr### [at] gmx de> wrote in message
news:3CB### [at] gmx de...
>
> Nice, but the individual stones look a bit too uniformly oval, it's
> probably difficult to build a wall with more irregularly formed stones,
> but you could try blob-like shapes.
>
Oh - that's not really a problem. Each stone is a different iso-surface, just
not different enough yet. The main problem is some merging of seperate stones,
but I don't think that's going to show up.
Here's the code so far (God, I love trace):
#version 3.5;
#include "colors.inc"
#include "functions.inc"
#declare Rand1 = seed(4325);
global_settings {
assumed_gamma 1.0
}
camera {
location <0.0, 1.5, -50>
look_at 0
}
light_source {
<0, 0, 0> // light's position (translated below)
color rgb <1, 1, 1> // light's color
translate <-30, 30, -30>
}
#macro MakeWall(WallLen, WallHi)
#declare BestY = 0;
#declare Wall = object{WallGround};
#declare Building = true;
#while(Building)
#declare FRandX = rand(Rand1) + 0.5;
#declare FRandY = rand(Rand1) + 0.5;
#declare FRandZ = rand(Rand1) + 0.5;
#declare FRandS = rand(Rand1) + 0.5;
#ifdef(fn_Brick)
#undef fn_Brick
#end
#declare fn_Brick =
function(x,y,z) {x*x + y*y + z*z - 1 +
f_noise3d(x*3*FRandX,y*3*FRandY,z*3*FRandZ)/(5*FRandS)}
#declare WallBrick =
isosurface {
function { fn_Brick(x, y, z) }
contained_by { box {<-2,-2,-2>,<2,2,2>}}
accuracy 0.001
max_gradient 5
pigment{LightGray}
}
#declare BestY = 100000000;
#declare XScale = rand(Rand1)*1/1 + 0.5;
#declare YScale = rand(Rand1)*1/2 + 0.5;
#declare ZScale = rand(Rand1)*1/2 + 0.5;
#declare Brick = object{
WallBrick
scale<XScale, YScale, ZScale>
}
#declare TraceX = 0;
#while(TraceX <= WallLen)
#declare Start = <TraceX, 2*WallHi, 0>;
#declare InterA = trace (Wall, Start, <0, -1, 0>);
#declare InterB = trace (WallGround, Start, <0, -1, 0>);
#if(InterA.y-InterB.y < BestY)
#declare BestX = InterA.x; // + XScale*0.75;
#declare BestY = InterA.y;
#end
#if(InterA.y-InterB.y > WallHi)
#declare Building = false;
#end
#declare TraceX = TraceX + (2*XScale);
#end
#declare Wall = union{
object{Wall}
object{Brick translate<BestX, BestY + YScale, 0>}
}
#end
#end
#declare fn_Ground = function(x,y,z) {y-sin(x/5)/1} // cylinder function
#declare WallGround =
isosurface {
function { fn_Ground(x, y, z) }
contained_by { box {<-5,-1,-50>,<125,1,5>}}
accuracy 0.001
max_gradient 5
pigment{Green}
}
#declare WallLen = 120;
#declare WallHi = 10;
MakeWall(WallLen,WallHi) object{Wall translate x*(-WallLen/2)}
Post a reply to this message
|
![](/i/fill.gif) |